#include <iostream>
#include <vector>
#include <cstdio> 
#include <queue>
#include <algorithm>

#define in read()
#define fi first
#define se second
#define pb push_back

using namespace std;

typedef long long ll;
typedef double db;
typedef vector < int >  vec;
typedef pair < int , int > pii;

ll read() {
    ll x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 1e5 + 10;

int n; ll m;
struct obj { ll x; int t; } p[N];
bool operator < (obj a,obj b) { return a.x < b.x; }
priority_queue < int > q;

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
    n = in,m = in; for(int i = 1;i <= n;i++) p[i].x = in,p[i].t = in;
    sort(p + 1,p + n + 1); int ans = 0,cur = 0;
    for(int i = 1;i <= n;i++) {
	m -= p[i].x - p[i - 1].x;
	while(m < 0 && q.size()) m += q.top(),q.pop(),cur--;
	if(m - p[i].t >= 0) q.push(p[i].t),cur++,m -= p[i].t;
	else if(q.size() && p[i].t < q.top()) m += p[i].t - q.top(),q.pop(),q.push(p[i].t);
	ans = max(ans,cur);
    }
    printf("%d\n",ans); return 0;
} 
